﻿<script language ="javascript" type="text/javascript" >
 <!--
     function judgeNumber(obj)
       {
           var sTicket = obj.id;
           if(sTicket == "StartTicket")
           {
               var iStartRe = form1.StartTicket.value;
               if(iStartRe.length >0)
			   {
			     if(isNaN(iStartRe))
			     {
			        alert("请输入整数");
			        form1.StartTicket.value = "";
			        return;
			     }
			  }  
           }
           
           if(sTicket == "EndTicket")
           {
               var iEtartRe = form1.EndTicket.value;
               if(iEtartRe.length >0)
			   {
			     if(isNaN(iEtartRe))
			     {
			        alert("请输入整数");
			        form1.EndTicket.value = "";
			        return;
			     }
			  }  
           }
         }  
           
 function ChoiceAllTicket(obj)
 {               
   var iPCount = form1.PCount.value;  //总页数
   var iPIndex = form1.PIndex.value;  //页的索引数.0
   var iPSize  = form1.PSize.value;   //每页显示的记录数
   var iRCount = form1.RCount.value;  //总的记录数
   iPCount = iPCount*1;
   iPIndex = iPIndex*1+1;     //加1
   iPSize  = iPSize*1;
   iRCount = iRCount*1;
               
   var sCol = "";
               
   if(obj.checked)
   {               
     if(iPCount>iPIndex)               //当前页不是最后一页时
     {
       for(i =0;i<iPSize;i++)
       {
         form1.OneTicketNo[i].checked =true;
         var sOneTicketNo = form1.OneTicketNo[i].value;
         var sOne = sOneTicketNo.split('^');
         sCol = sCol + sOne[1] + "|";
         form1.ChoiceInfo.value = sCol ;
       }
    }
    else
    {
       var iStartNum = (iPIndex-1)*iPSize ;
       var iEndNum = iRCount - iStartNum;
       if(iEndNum == 1)
       {
         form1.OneTicketNo.checked =true;
         var sOneTicketNo = form1.OneTicketNo.value;
         var sOne = sOneTicketNo.split('^');
         sCol = sCol + sOne[1] + "|";
         form1.ChoiceInfo.value = sCol ;
       }
       else
       {
         for(i =0;i<iEndNum;i++)
         {
           form1.OneTicketNo[i].checked =true;
           var sOneTicketNo = form1.OneTicketNo[i].value;
           var sOne = sOneTicketNo.split('^');
           sCol = sCol + sOne[1] + "|";
           form1.ChoiceInfo.value = sCol ;
         }
       }
     }
   }             
   else
   {
     form1.ChoiceInfo.value = "";
     if(iPCount>iPIndex)               //当前页不是最后一页时
     {
        for(i =0;i<iPSize;i++)
        {
          form1.OneTicketNo[i].checked =false;
        }
      }
      else
      {
         var iStartNum = (iPIndex-1)*iPSize ;
         var iEndNum = iRCount - iStartNum;
         if(iEndNum == 1)
         {
           form1.OneTicketNo.checked =false;
         }
         else
         {
           for(i =0;i<iEndNum;i++)
           {
              form1.OneTicketNo[i].checked =false;
           }
         }
       }
     }           
    //alert(form1.ChoiceInfo.value);
  }
  
  function ChoiceOneTicket(obj)
 {               
   var iPCount = form1.PCount.value;  //总页数
   var iPIndex = form1.PIndex.value;  //页的索引数.0
   var iPSize  = form1.PSize.value;   //每页显示的记录数
   var iRCount = form1.RCount.value;  //总的记录数
   iPCount = iPCount*1;
   iPIndex = iPIndex*1+1;
   iPSize  = iPSize*1;
   iRCount = iRCount*1;
               
   var sCol = "";
               
                  
   if(iPCount>iPIndex)               //当前页不是最后一页时
   {
       for(i =0;i<iPSize;i++)
       {
         if(form1.OneTicketNo[i].checked ==true)
         {
           var sOneTicketNo = form1.OneTicketNo[i].value;
           var sOne = sOneTicketNo.split('^');
           sCol = sCol + sOne[1] + "|";
         }
       }
       form1.ChoiceInfo.value = sCol ;
    }
    else
    {
       var iStartNum = (iPIndex-1)*iPSize ;
       var iEndNum = iRCount - iStartNum;
       if(iEndNum == 1)
       {
         if(form1.OneTicketNo.checked ==true)
         {
           var sOneTicketNo = form1.OneTicketNo.value;
           var sOne = sOneTicketNo.split('^');
           sCol = sCol + sOne[1] + "|";           
         }  
         form1.ChoiceInfo.value = sCol ;
       }
       else
       {
         for(i =0;i<iEndNum;i++)
         {
           if(form1.OneTicketNo[i].checked ==true)
           {
             var sOneTicketNo = form1.OneTicketNo[i].value;
             var sOne = sOneTicketNo.split('^');
             sCol = sCol + sOne[1] + "|";             
           }
         }
         form1.ChoiceInfo.value = sCol ;
       }
     }          
    //alert(form1.ChoiceInfo.value);
  }
  
  //去掉重复的数据
function DelRepeatData(sData)
{
   var NORepeatDate = ""; 
   var ary = sData.split('|');
   var iary = ary.length;
   for(i=0;i<ary.length;i++)
   {
       var itype = 0;
       for (j=i+1;j<ary.length;j++)
       {
          if(ary[i] ==ary[j])
          {
            itype =1;
            break;
          }
       }
       if(itype == 0 && i!= iary-1)
       {
         NORepeatDate = NORepeatDate + ary[i] + "|";
       }
       else
       {
         itype =0;
       }
   }
   return NORepeatDate; 
}

//去掉重复的数据
function DelRepeatData2(sData)
{
   var NORepeatDate = ""; 
   var ary = sData.split('|');
   var iary = ary.length;
   for(i=0;i<ary.length;i++)
   {
       var itype = 0;
       for (j=i+1;j<ary.length;j++)
       {
          if(ary[i] ==ary[j])
          {
            itype =1;
            break;
          }
       }
       if(itype == 0 && i!= iary-1)
       {
         NORepeatDate = NORepeatDate + ary[i] + "|";
       }
       else
       {
         itype =0;
       }
   }
   return NORepeatDate; 
}

//单选
function  AddRemoveValues(oChk) 
{
    //ary=oChk.value.split('^');
    var sCol = oChk.value + "|";
    if(oChk.checked)
    {
       form1.ChoiceInfo.value = DelRepeatData(form1.ChoiceInfo.value + sCol) ;
    }
    else
    {
        form1.ChoiceInfo.value = form1.ChoiceInfo.value.replace(sCol,"");
    }
    //alert(form1.ChoiceInfo.value);
}
	
//全选
function Allselect(obj)
{    
    var hid=window.document.getElementById ("hidAll");
    if(obj.checked)
    {
        hid.value='1';
    }
    else
    {
        hid.value='0';
    }
    var btn=window.document.getElementById ("BtnAll");
    if(btn!=null)btn.click();
}
			
 // -->
</script>

